﻿<%@ Page Language="C#" AutoEventWireup="true" CodeFile="edit.aspx.cs" Inherits="Manage_admin_edit" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>添加用户</title>
    <link rel="stylesheet" type="text/css" href="../skin/css/base.css" />
    <script type="text/javascript">

        function checkForm() {
            var name = document.getElementById("txtusername");
            var pwd = document.getElementById("txtpwd");
            var cpwd = document.getElementById("txtconfirmpwd");
            var userid = document.getElementById("hidUserId");
            var group = document.getElementById("ddlgroup");
            if (group.value == 0) {
                alert("请选择所属角色！");
                return false;
            }
            if (name.value.length == 0) {
                alert("登入名称不能为空！");
                name.focus();
                return false;
            }
            if (userid==0&&pwd.value.length == 0) {
                alert("密码不能为空！");
                pwd.focus();
                return false;
            }
            if (userid&&cpwd.value.length == 0) {
                alert("确认密码不能为空！");
                cpwd.focus();
                return false;
            }
            if (cpwd.value!=pwd.value) {
                alert("两次密码输入不一致！");
                cpwd.focus();
                return false;
            }

        }
  </script>
<style type="text/css">
<!--
.STYLE4 {
	font-size: 16px;
	color: #FF0000;
}
.STYLE5 {color: #FF0000}
-->
</style>
</head>
<body leftmargin="8" topmargin="8" background='../skin/images/allbg.gif'>
    <form id="form1" runat="server">
    <!--  快速转换位置按钮  -->
    <table width="98%" border="0" cellpadding="0" cellspacing="1" bgcolor="#D1DDAA" align="center">
      <tr>
        <td height="26" background="../skin/images/newlinebg3.gif"><table width="98%" border="0" cellspacing="0" cellpadding="0">
            <tr>
              <td align="center">
                &nbsp;<input type='button' class="coolbg np" onclick="location='user.aspx';" value='用户列表' />
              </td>
            </tr>
          </table></td>
      </tr>
    </table>
<!--  内容列表   -->
    <div >
      <table width="98%" border="0" cellpadding="2" cellspacing="1" bgcolor="#D1DDAA" align="center" style="margin-top:8px">
        <tr bgcolor="#E7E7E7">
          <td height="24" colspan="3" background="../skin/images/tbg.gif"><div align="center" class="STYLE4">
              用户信息</div><asp:HiddenField ID="hidUserId" runat="server" Value="0" /></td>
        </tr>
       
        <tr align='center' bgcolor="#FFFFFF" onMouseMove="javascript:this.bgColor='#FCFDEE';" onMouseOut="javascript:this.bgColor='#FFFFFF';" height="22" >
          <td width="13%" align="left"><div align="left">所属角色：</div></td>
           <td width="49%"><div align="left">
             <asp:DropDownList ID="ddlgroup" runat="server"></asp:DropDownList>
            </div></td>
          <td width="38%"><div align="left" class="STYLE5">*</div></td>
        </tr>
        <tr align='center' bgcolor="#FFFFFF" onMouseMove="javascript:this.bgColor='#FCFDEE';" onMouseOut="javascript:this.bgColor='#FFFFFF';" height="22" >
          <td width="13%" align="left"><div align="left">编号：</div></td>
           <td width="49%"><div align="left">
             
              <asp:TextBox ID="txtcode" runat="server" Width="268px"></asp:TextBox>
            </div></td>
          <td width="38%"><div align="left" class="STYLE5">*</div></td>
        </tr>
        <tr align='center' bgcolor="#FFFFFF" onMouseMove="javascript:this.bgColor='#FCFDEE';" onMouseOut="javascript:this.bgColor='#FFFFFF';" height="22" >
          <td width="13%" align="left"><div align="left">登入名称：</div></td>
           <td width="49%"><div align="left">
             
              <asp:TextBox ID="txtusername" runat="server" Width="268px"></asp:TextBox>
            </div></td>
          <td width="38%"><div align="left" class="STYLE5">*</div></td>
        </tr>
        <tr align='center' bgcolor="#FFFFFF" onMouseMove="javascript:this.bgColor='#FCFDEE';" onMouseOut="javascript:this.bgColor='#FFFFFF';" height="22" >
          <td width="13%" align="left"><div align="left">登入密码：</div></td>
           <td width="49%"><div align="left">
             
              <asp:TextBox ID="txtpwd" runat="server" TextMode="Password" Width="268px"></asp:TextBox>
            </div></td>
          <td width="38%"><div align="left" class="STYLE5">*</div></td>
        </tr>
        <tr align='center' bgcolor="#FFFFFF" onMouseMove="javascript:this.bgColor='#FCFDEE';" onMouseOut="javascript:this.bgColor='#FFFFFF';" height="22" >
          <td width="13%" align="left"><div align="left">确认密码：</div></td>
           <td width="49%"><div align="left">
             
              <asp:TextBox ID="txtconfirmpwd" runat="server" TextMode="Password" Width="268px"></asp:TextBox>
            </div></td>
          <td width="38%"><div align="left" class="STYLE5">*</div></td>
        </tr>
        <tr align='center' bgcolor="#FFFFFF" onMouseMove="javascript:this.bgColor='#FCFDEE';" onMouseOut="javascript:this.bgColor='#FFFFFF';" height="22" >
          <td width="13%" align="left"><div align="left">是否激活：</div></td>
           <td width="49%"><div align="left">
              <asp:DropDownList ID="ddlvalid" runat="server">
                <asp:ListItem Value="1" Text="是" Selected="True"></asp:ListItem>
                <asp:ListItem Value="0" Text="否"></asp:ListItem>
              </asp:DropDownList>
            </div></td>
          <td width="38%"><div align="left" class="STYLE5">*</div></td>
        </tr>
      </table>
      <table width="98%" border="0" cellpadding="2" cellspacing="1" bgcolor="#D1DDAA" align="center" style="margin-top:8px">
        <tr bgcolor="#E7E7E7">
	        <td height="24" colspan="10" background="../skin/images/tbg.gif">&nbsp;权限列表&nbsp;</td>
        </tr>
        <tr align="center" bgcolor="#FAFAF1" height="22">
	        <td width="70%">菜单项</td>
	        <td width="10%">权限</td>
            <td width="20%">操作</td>
        </tr>
         <asp:Repeater ID="dgUserPermision" runat="server" 
              onitemcommand="dgUserPermision_ItemCommand" 
              onitemdatabound="dgUserPermision_ItemDataBound"  >
            <ItemTemplate>
                <tr align='center' bgcolor="#FFFFFF" onmousemove="javascript:this.bgColor='#FCFDEE';" onmouseout="javascript:this.bgColor='#FFFFFF';" height="22" >
	                <td align="left" style="width:70%"><%#Eval("MenuName")%><asp:HiddenField ID="hdfMenuId" runat="server" Value='<%Eval("MenuId") %>' /></td>
                    <td align="left" style="width:10%"><asp:DropDownList ID="ddlPermision" runat="server"></asp:DropDownList><asp:HiddenField ID="hdfPermisionId" runat="server" Value='<%#Eval("PermisionId") %>' /></td>
	                <td><asp:LinkButton ID="lbtndel" runat="server" CommandName="Delete" CommandArgument='<%#Eval("UserId") %>' OnClientClick="return confirm('你确定删除吗?');">删除</asp:LinkButton></td>
                </tr>
            </ItemTemplate>
        </asp:Repeater>
       </table>
      <!--  提交 -->
      <table width='98%'  border='0' cellpadding='1' cellspacing='1' bgcolor='#CBD8AC' align="center" style="margin-top:8px">
        <tr bgcolor='#EEF4EA'>
          <td background='skin/images/wbg.gif' align='center'><table border='0' cellpadding='0' cellspacing='0'>
              <tr>
                <td width='90' align='center'>&nbsp;</td>
                <td width='70'&nbsp;</td>
                <td width='160'><asp:Button ID="btnsave" runat="server" Text="保存" 
                        OnClientClick="return checkForm();false" onclick="btnsave_Click" /></td>
                <td width='110'>&nbsp;</td>
                <td>&nbsp;</td>
              </tr>
            </table></td>
        </tr>
      </table>
    </div>
    </form>
</body>
</html>
